#include<bits/stdc++.h>
using namespace std;
int a[100001];
int main(){
    int n;
    freopen("color.in","r",stdin);
    freopen("color.out","w",stdout);
    int t;
    cin>>t;
    for(int i=1;i<=t;i++){
        cin>>n;
        for(int i=1;i<=n;i++){
            cin>>a[i];
        }
    }
    freopen("color.ans","r",stdin);
    for(int i=1;i<=t;i++){
        int a;
        cin>>a;
        cout<<a<<endl;
    }

    return 0;
}
